package com.itheima.mp_demo.cofig;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//
@Configuration
public class Myconfig {

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
         //需要一个拦截器
          mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
          mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
          return mybatisPlusInterceptor;
    }

}
